export function last7Days(dayTimeList,dayTimeYearList){
  let date = new Date();
  let base = Date.parse(date); // 转换为时间戳
  let oneDay = 24 * 3600 * 1000
  let daytimeArr = []
  let daytimeYearArr = []
  for (let i = 6; i >= 0; i--) { //前七天的时间
    let now = new Date(base);
    base-= oneDay;
    let myear = now.getFullYear();
    let month = now.getMonth() + 1;
    let mday = now.getDate()
    daytimeArr.push([month >= 10 ? month : '0' + month, mday >= 10 ? mday : '0' + mday].join('-'))
    daytimeYearArr.push([myear,month >= 10 ? month : '0' + month, mday >= 10 ? mday : '0' + mday].join('-'))
  }
  for (let i = daytimeArr.length - 1; i >= 0; i--) {
    dayTimeList.push(daytimeArr[i])
  }
  for (let i = daytimeYearArr.length - 1; i >= 0; i--) {
    dayTimeYearList.push(daytimeYearArr[i])
  }
}
export function last7DaysFromYesterDay(dayTimeList,dayTimeYearList){
  let date = new Date();
  let base = Date.parse(date); // 转换为时间戳
  let oneDay = 24 * 3600 * 1000
  let daytimeArr = []
  let daytimeYearArr = []
  base-= oneDay;
  for (let i = 6; i >= 0; i--) { //前七天的时间
    let now = new Date(base);
    base-= oneDay;
    let myear = now.getFullYear();
    let month = now.getMonth() + 1;
    let mday = now.getDate()
    daytimeArr.push([month >= 10 ? month : '0' + month, mday >= 10 ? mday : '0' + mday].join('-'))
    daytimeYearArr.push([myear,month >= 10 ? month : '0' + month, mday >= 10 ? mday : '0' + mday].join('-'))
  }
  for (let i = daytimeArr.length - 1; i >= 0; i--) {
    dayTimeList.push(daytimeArr[i])
  }
  for (let i = daytimeYearArr.length - 1; i >= 0; i--) {
    dayTimeYearList.push(daytimeYearArr[i])
  }
}
